import {
  Directive,
  ElementRef,
  HostBinding,
  Input,
  OnInit,
  Renderer2,
} from '@angular/core';

@Directive({
  selector: '[appGridImg]',
})
export class GridImgDirective implements OnInit {
  @HostBinding('style.width') @Input() appGridImg: string = '2rem';
  @Input() fitMode: string = 'cover';
  constructor(private el: ElementRef, private rd2: Renderer2) {}
  ngOnInit(): void {
    this.rd2.setStyle(this.el.nativeElement, 'grid-area', 'image');
    this.rd2.setStyle(this.el.nativeElement, 'object-fit', this.fitMode);
    // this.rd2.setStyle(this.el.nativeElement, 'width', this.appGridImg);
  }
}
